<?php
    $idCliente = $this->uri->segment(3);
    if($idCliente == NULL) redirect('principalcontroller');
    $query = $this->clientemodel->buscarClientePorId($idCliente)->row();	
?>

<div class="span10">
		  <div class="row-fluid">
			<div class="page-header">
				<h1><?=$titulo;?></h1>
			</div>
			<?php $atributos_formulario = array('id'=>'exm1','role'=>'form','onsubmit'=>'PreventMultipleSubmit()','class'=>'form-inline');
                            echo form_open ("clientecontroller/alterarCliente/".$idCliente,$atributos_formulario);
                            if(validation_errors())
                            {?>
                                <div class="alert alert-danger">
                                    <button type="button" class="close " data-dismiss="alert">&times;</button>
                                    <span><?=validation_errors();?></span>
                                </div>
                            <?php                            
                            }
                            
                             if($this->session->flashdata('cadastrook')){?>
                                <div class="alert alert-success">
                                    <button type="button" class="close " data-dismiss="alert">&times;</button>
                                    <p><?=$this->session->flashdata('cadastrook');?></p>
                                </div>
                             <?php
                            }?>
                   
                      <fieldset>
                          <div style="float: left; padding: 5px">
                                <h3>DADOS PESSOAIS</h3>
                              <hr />
					<div class="input-prepend">
                                <span class="add-on ticket">Nome</span>                                   
						
                                                    <?php echo form_input(array('name'=>'nome', 'id'=>'nome', 'type'=>'text','class'=>'input-xlarge form-control ','placeholder'=>'Nome Completo','required'=>'required','value'=>$query->nome), mb_strtoupper(set_value('nome')));?>
                                                    <?php echo form_input(array('name'=>'idCliente', 'id'=>'idCliente', 'type'=>'hidden','class'=>'input-xlarge form-control ','placeholder'=>'Nome Completo','value'=>$query->id_cliente), mb_strtoupper(set_value('idCliente')));?>
                                                
                                                
                                        </div><br><br>
					 
                                  <div class="input-prepend">
                                <span class="add-on ticket">CPF</span>                                 
						
                                                    <?php echo form_input(array('name'=>'cpf', 'id'=>'cpf', 'type'=>'text','class'=>'input-xlarge form-control ','placeholder'=>'Digite o CPF','value'=>$query->cpf),set_value('cpf'));?>
                                              
                                                
                                  </div><br><br>
                                    <div class="input-prepend">
                                <span class="add-on ticket">RG</span>                                     
						
                                                    <?php echo form_input(array('name'=>'rg', 'id'=>'rg', 'type'=>'text','class'=>'input-xlarge form-control ','placeholder'=>'RG','value'=>$query->rg),set_value('rg'));?>
                                                
                                                
                                    </div><br><br>  
                                     
                           <div class="input-prepend">
                                <span class="add-on ticket">Telefone</span>
                                <?php echo form_input(array('name'=>'telefone', 'id'=>'telefone', 'type'=>'text','class'=>'input-xlarge form-control inputTelefone','placeholder'=>'Informe o telefone','required'=>'required','value'=>$query->telefone),set_value('telefone'));?>
                           </div><br /><br />
                                     <div class="input-prepend">
                                    <span class="add-on ticket">Com.</span>
                                    <?php echo form_input(array('name'=>'telefoneComercial', 'id'=>'telefoneComercial', 'type'=>'text','class'=>'input-xlarge form-control inputTelefone','placeholder'=>'Informe o telefone comercial','required'=>'required','value'=>$query->telefoneComercial),set_value('telefoneComercial'));?>                                   
                                </div><br><br>
                                                            
                          </div>
                           <div style="float: left; padding: 5px">
                               <h3>DADOS ENDEREÇO</h3>
                              <hr />
                              <div class="input-prepend cep-label">
                                <span class="add-on ticket">CEP</span>
                                   <?php echo form_input(array('name'=>'cep', 'id'=>'cep', 'type'=>'text','class'=>'input-xlarge form-control ','maxlength'=>'9','placeholder'=>'Informe o CEP','value'=>$query->cep),set_value('cep'));?>
                                </div><br><br>

                            <div class="input-prepend">
                                <span class="add-on ticket">Rua</span>
                                <?php echo form_input(array('name'=>'rua', 'id'=>'rua', 'type'=>'text','class'=>'input-xlarge form-control ','placeholder'=>'Nome da Rua / Logradouro','value'=>$query->endereco),set_value('rua'));?>
                            </div><br><br>

                         

                            <div class="input-prepend">
                                <span class="add-on ticket">Bairro</span>
                                <?php echo form_input(array('name'=>'bairro', 'id'=>'bairro', 'type'=>'text','class'=>'input-xlarge form-control ','placeholder'=>'Informe Bairro','value'=>$query->bairro),set_value('bairro'));?>
                            </div><br><br>

                            <div class="input-prepend">
                                <span class="add-on ticket">Cidade</span>
                                <?php echo form_input(array('name'=>'cidade', 'id'=>'cidade', 'type'=>'text','class'=>'input-xlarge form-control ','placeholder'=>'Informe a Cidade','value'=>$query->cidade),set_value('cidade'));?>
                           </div><br><br>

                            <div class="input-prepend">
                                <span class="add-on ticket">UF</span>
                                <?php echo form_input(array('name'=>'uf', 'id'=>'uf', 'type'=>'text','class'=>'input-xlarge form-control ','placeholder'=>'Informe o UF','value'=>$query->estado),set_value('uf'));?>
                           </div><br><br>
                          

                           </div> 
                       
                          
                          <br clear="all" />
					<div class="form-actions">
                                            <button type="submit" id="btSubmit" class="btn btn-primary pull-left"> Enviar </button>&nbsp;
                                            <button type="reset" id="carregando" class="btn btn-slate-action pull-left x" disabled="disabled"> Aguarde ...</button>
                                            <?=anchor(base_url()."clientecontroller/cadastrarcliente","Cancelar",array('class'=>'btn'));?>                                                
					</div>					
				</fieldset>
			</form>
		  </div>
        </div>
 <script type="text/javascript">
        function PreventMultipleSubmit(){
            document.getElementById("btSubmit").disabled = true;       
            document.getElementById("btSubmit").style.display = "none";
            document.getElementById("carregando").style.display = "block";        
        }
  </script>
